<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg" id="globalMessages"/>
    
    <rich:panel>
        <f:facet name="header">Hole</f:facet>



        <s:decorate id="ladiesHandicap" template="layout/display.xhtml">
            <ui:define name="label">ladiesHandicap</ui:define>
            #{holeHome.instance.ladiesHandicap}
        </s:decorate>


        <s:decorate id="ladiesPar" template="layout/display.xhtml">
            <ui:define name="label">ladiesPar</ui:define>
            #{holeHome.instance.ladiesPar}
        </s:decorate>


        <s:decorate id="mensHandicap" template="layout/display.xhtml">
            <ui:define name="label">mensHandicap</ui:define>
            #{holeHome.instance.mensHandicap}
        </s:decorate>


        <s:decorate id="mensPar" template="layout/display.xhtml">
            <ui:define name="label">mensPar</ui:define>
            #{holeHome.instance.mensPar}
        </s:decorate>


        <s:decorate id="name" template="layout/display.xhtml">
            <ui:define name="label">name</ui:define>
            #{holeHome.instance.name}
        </s:decorate>


        <s:decorate id="number" template="layout/display.xhtml">
            <ui:define name="label">number</ui:define>
            #{holeHome.instance.number}
        </s:decorate>

        <div style="clear:both"/>
        
    </rich:panel>
    
    <div class="actionButtons">      

        <s:button view="/HoleEdit.xhtml" 
                    id="edit" 
                 value="Edit"/>

        <s:button view="/#{empty holeFrom ? 'HoleList' : holeFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab label="course">
    <div class="association" id="courseParent">
        
        <h:outputText value="There is no course associated with this hole." 
                   rendered="#{holeHome.instance.course == null}"/>
        
        <rich:dataTable var="course" 
                   value="#{holeHome.instance.course}" 
                rendered="#{holeHome.instance.course != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="courseTable">
            <h:column>
                <f:facet name="header">id</f:facet>
                #{course.id}
            </h:column>
            <ui:remove>
            <h:column>
                <f:facet name="header">description</f:facet>
                #{course.description}
            </h:column>
            </ui:remove>
            <h:column>
                <f:facet name="header">designer</f:facet>
                #{course.designer}
            </h:column>
            <h:column>
	    	    <f:facet name="header">facility id</f:facet>
		    	#{course.facility.id}
            </h:column>
            <h:column>
                <f:facet name="header">fairways</f:facet>
                #{course.fairways}
            </h:column>
            <h:column>
                <f:facet name="header">greens</f:facet>
                #{course.greens}
            </h:column>
            <h:column>
                <f:facet name="header">name</f:facet>
                #{course.name}
            </h:column>
            <h:column>
                <f:facet name="header">numHoles</f:facet>
                #{course.numHoles}
            </h:column>
            <h:column>
                <f:facet name="header">signatureHole</f:facet>
                #{course.signatureHole}
            </h:column>
            <h:column>
                <f:facet name="header">yearBuilt</f:facet>
                #{course.yearBuilt}
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link id="viewcourse" 
                     value="View" 
                      view="/Course.xhtml">
                    <f:param name="courseId" 
                           value="#{course.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    </rich:tab>

    <rich:tab label="tees">
    <div class="association" id="teesChildren">
        
        <h:outputText value="There are no tees associated with this hole."
                   rendered="#{empty holeHome.tees}"/>
        
        <rich:dataTable value="#{holeHome.tees}" 
                       var="tee" 
                  rendered="#{not empty holeHome.tees}" 
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="teesTable">
            <h:column>
                <f:facet name="header">holeId</f:facet>
                #{tee.id.holeId}
            </h:column>
            <h:column>
                <f:facet name="header">teeSetId</f:facet>
                #{tee.id.teeSetId}
            </h:column>
            <h:column>
                <f:facet name="header">distance</f:facet>
                <h:outputText value="#{tee.distance}"/>
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link id="selecttee" 
                     value="View" 
                      view="/Tee.xhtml">
                    <f:param name="teeHoleId" 
                            value="#{tee.id.holeId}"/>
                    <f:param name="teeTeeSetId" 
                            value="#{tee.id.teeSetId}"/>
                    <f:param name="teeFrom" value="Hole"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    
    <div class="actionButtons">
        <s:button 
               value="Add tee"
                view="/TeeEdit.xhtml">
            <f:param name="holeId" 
                    value="#{holeHome.instance.id}"/>
            <f:param name="teeFrom" value="Hole"/>
        </s:button>
    </div>        
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
